//
//  SmallDecisionsDlpComplateViewController.m
//  SmallDecisions
//
//  Created by 李付雄 on 2025/7/26.
//

#import "SmallDecisionsDlpComplateViewController.h"

@interface SmallDecisionsDlpComplateViewController ()
@property(nonatomic,strong) UIView *dlpContainerView;
@property(nonatomic,strong) UILabel *dlpTitleLabel;
@property(nonatomic,strong) UILabel *dlpContentLabel;
@property(nonatomic,strong) UIButton *dlpSureBtn;
@end

@implementation SmallDecisionsDlpComplateViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self dlpContainerView];
    [self dlpTitleLabel];
    [self dlpContentLabel];
    [self dlpSureBtn];
}

- (UIView *)dlpContainerView {
    if(!_dlpContainerView) {
        _dlpContainerView = [[UIView alloc] init];
        _dlpContainerView.backgroundColor = SmallDecisionsPurpleColor;
        _dlpContainerView.layer.cornerRadius = 10;
        _dlpContainerView.layer.masksToBounds = YES;
        [self.view addSubview:_dlpContainerView];
        [_dlpContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(30);
            make.right.mas_equalTo(-30);
            make.centerY.mas_equalTo(-30);
        }];
    }
    return _dlpContainerView;
}

- (UILabel *)dlpTitleLabel {
    if(!_dlpTitleLabel) {
        _dlpTitleLabel = [[UILabel alloc] init];
        _dlpTitleLabel.textColor = SmallDecisionsThemeColor;
        _dlpTitleLabel.font = SmallDecisionsSetFontSize(18);
        _dlpTitleLabel.text = @"幸运选择";
        _dlpTitleLabel.textAlignment = 1;
        [self.dlpContainerView addSubview:_dlpTitleLabel];
        [_dlpTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_offset(20);
            make.left.mas_equalTo(20);
            make.right.mas_equalTo(-20);
        }];
    }
    return _dlpTitleLabel;
}


- (UILabel *)dlpContentLabel {
    if(!_dlpContentLabel) {
        _dlpContentLabel = [[UILabel alloc] init];
        _dlpContentLabel.textColor = SmallDecisionsThemeFontColor;
        _dlpContentLabel.font = SmallDecisionsSetBoldFontSize(28);
        _dlpContentLabel.numberOfLines = 0;
        _dlpContentLabel.textAlignment = 1;
        _dlpContentLabel.text = self.complateContent;
        [self.dlpContainerView addSubview:_dlpContentLabel];
        [_dlpContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.dlpTitleLabel.mas_bottom).offset(20);
            make.left.mas_equalTo(20);
            make.bottom.right.mas_equalTo(-20);
        }];
    }
    return _dlpContentLabel;
}

- (UIButton *)dlpSureBtn {
    if(!_dlpSureBtn) {
        _dlpSureBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_dlpSureBtn setTitle:@"确定" forState:UIControlStateNormal];
        [_dlpSureBtn setTitleColor:SmallDecisionsThemeFontColor forState:UIControlStateNormal];
        [_dlpSureBtn setTitleColor:[UIColor clearColor] forState:UIControlStateHighlighted];
        _dlpSureBtn.titleLabel.font = SmallDecisionsSetBoldFontSize(16);
        _dlpSureBtn.layer.cornerRadius = 30;
        _dlpSureBtn.layer.masksToBounds = YES;
        _dlpSureBtn.backgroundColor = SmallDecisionsThemeColor;
        [_dlpSureBtn addTarget:self action:@selector(dlpSureBtnAction) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:_dlpSureBtn];
        [_dlpSureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(60);
            make.left.equalTo(self.dlpContainerView).offset(20);
            make.right.equalTo(self.dlpContainerView).offset(-20);
            make.top.equalTo(self.dlpContainerView.mas_bottom).offset(40);
        }];
    }
    return _dlpSureBtn;
}

- (void)dlpSureBtnAction {
    [SmallDecisionsNavigatorManager dismissViewControllerAnimated:YES completion:nil];
}


@end
